#pragma once

#include <ClanLib/core.h>
#include <vector>
#include <stack>
#include "ConvexHullWorkUnit.h"

class ConvexHullSimulationStepper
{
public:
	ConvexHullSimulationStepper(const std::vector<clan::Vec2d>& points);//Initializes the Simulation with the points,for which the convex hull should be found
	~ConvexHullSimulationStepper(void);
	void Step(void);//Makes the convex hull algorithm proceed one step, meaning proceeding by one test, so that a redraw is necessary to update the simulation view
	void Run(void);
	void CalcRecursive(void);
	std::vector<clan::Vec2d> GetPointsOfInterest(void) const;
	std::vector<clan::Line2d> GetConvexHullLines(void) const;
private:
	const std::vector<clan::Vec2d> m_points;//holds all points, for which the convex hull should be found
	std::vector<clan::Vec2d> m_pointsOfInterest;
	std::vector<clan::Line2d> m_convexHullLines;
	std::stack<ConvexHullWorkUnit*> m_workUnits;

	void m_RecomputePointsOfInterest( void );
	void m_RecomputeConvexHullLines( void );
};

